package com.example.hhhh.util;

/**
 * 重复点击工具类
 * Created by Kinwee on 2017/2/27.
 */
public class DoubleClickUtil {

    private static long lastClickTime = 0L;
    private static final long INTERVAL_TIME = 500;

    /**
     * 是否重复点击
     */
    public static boolean isMuitClick() {
        long currClickTime = System.currentTimeMillis();
        if (Math.abs(currClickTime - lastClickTime) < INTERVAL_TIME) {
            return true;
        }
        lastClickTime = System.currentTimeMillis();
        return false;
    }

    public static boolean isMuitClick(long intervalTime) {
        long currClickTime = System.currentTimeMillis();
        if (Math.abs(currClickTime - lastClickTime) < intervalTime) {
            return true;
        }
        lastClickTime = System.currentTimeMillis();
        return false;
    }

}
